/*    */ package nccloud.pubimpl.platform.meta;
/*    */ 
/*    */ import nc.vo.ml.NCLangRes4VoTransl;
/*    */ import nccloud.base.collection.tabular.IRow;
/*    */ import nccloud.base.collection.tabular.IRowSet;
/*    */ import nccloud.base.exception.ExceptionUtils;
/*    */ import nccloud.base.meta.NCBillMeta;
/*    */ import nccloud.base.meta.NCBillMetaItem;
/*    */ import nccloud.pubimpl.platform.db.DataAccess;
/*    */ import nccloud.pubitf.platform.db.SqlParameterCollection;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class BillMetaLoader
/*    */ {
/*    */   public NCBillMeta loadByFullPath(String path) {
	if(null == path) return null;
/* 27 */     String[] strs = path.split("\\.");
/* 28 */     if (strs.length != 2) {
/* 29 */
        /* 30 */
        String sb = NCLangRes4VoTransl.getNCLangRes().getStrByID("1501002_0", "01501001-0071") +
                /*    */
                /* 32 */
                path +
                /* 33 */
                NCLangRes4VoTransl.getNCLangRes().getStrByID("1501002_0", "01501002-0317");
/*    */       
/* 35 */       ExceptionUtils.wrapBusinessException(sb);
/*    */     } 
/* 37 */     String namespace = strs[0];
/* 38 */     String name = strs[1];
/* 39 */     IRowSet rowset = query(namespace, name);
/* 40 */     return construct(rowset);
/*    */   }
/*    */ 
/*    */   
/*    */   private NCBillMeta construct(IRowSet rowset) {
/* 45 */     NCBillMeta meta = null;
/* 46 */     BillMetaItemLoader loader = new BillMetaItemLoader();
/* 47 */     if (rowset.hasNext()) {
/* 48 */       IRow row = rowset.next();
/* 49 */       meta = convert(row);
/* 50 */       NCBillMetaItem[] items = loader.load(meta);
/* 51 */       meta.setItems(items);
/*    */     } 
/* 53 */     return meta;
/*    */   }
/*    */   
/*    */   private String constructSql() {
/* 57 */
    /* 58 */
    String sb = "select a.id, b.displayname, " +
            /* 59 */
            " a.name,b.namespace,b.id,b.resmodule,b.resid " +
            /* 60 */
            " from md_class a, md_component b " +
            /* 61 */
            " where a.componentid = b.id " + " and b.namespace = ? " +
            /* 62 */
            "and a.name = ? ";
/* 63 */     return sb;
/*    */   }
/*    */   
/*    */   private NCBillMeta convert(IRow row) {
/* 67 */     int index = 0;
/* 68 */     NCBillMeta meta = new NCBillMeta();
/* 69 */     meta.setId(row.getString(index++));
/* 70 */     meta.setLabel(row.getString(index++));
/* 71 */     meta.setName(row.getString(index++));
/* 72 */     meta.setNamespace(row.getString(index++));
/* 73 */     meta.setComponentid(row.getString(index++));
/* 74 */     meta.setResmodule(row.getString(index++));
/* 75 */     meta.setResid(row.getString(index++));
/* 76 */     return meta;
/*    */   }
/*    */   
/*    */   private IRowSet query(String namespace, String name) {
/* 80 */     String sql = constructSql();
/* 81 */     SqlParameterCollection paraCollection = new SqlParameterCollection();
/* 82 */     paraCollection.addChar(namespace);
/* 83 */     paraCollection.addChar(name);
/*    */     
/* 85 */     DataAccess dao = new DataAccess();
/* 86 */     return dao.query(sql, paraCollection);
/*    */   }
/*    */ }


/* Location:              E:\yonyou\homes\xxhome930\modules\platform\META-INF\lib\platform_nccloudLevel-1.jar!/nccloud/pubimpl/platform/meta/BillMetaLoader.class
 * Java compiler version: 17 (61.0)
 * JD-Core Version:       1.0.7
 */